﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    public class TreeList<T>
    {

        public string List<T>(Expression<Func<T, bool>> expression) 
       {

           
           return expression.ReduceExtensions().ToString();
       }
    }

    public interface ISpecification<T>
    {

        bool IsSatisfiedBy(T obj);
        Expression<Func<T, bool>> Expression { get; }
    }

    public abstract class Specification<T> : ISpecification<T>
    {
        #region ISpecification Members
        public virtual bool IsSatisfiedBy(T obj) { return this.Expression.Compile()(obj); }            public abstract Expression<Func<T, bool>> Expression { get; }
        #endregion  }
    }
}
